package com.homegoods.discover.presenter;

import com.homegoods.discover.model.MessageModel;
import com.kedll.library.mvp.AbstractRefreshPresenter;
import com.kedll.library.mvp.RefreshingView;

import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;

/**
 * @author QiQi
 */
public class MessagePresenter extends AbstractRefreshPresenter<RefreshingView> {
    public MessagePresenter(RefreshingView view) {
        super(view);
    }

    @Override
    protected void fetchData(boolean isLoadMore) {
        addSubscription(Observable.range(0, 5)
                .map(integer -> new MessageModel())
                .toList()
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(messageModels -> parserData(isLoadMore, messageModels)));
    }
}